package com.ssy.lingxi.marketing.model.constant;

import com.ssy.lingxi.common.language.LanguageHolder;

import java.util.Arrays;

/**
 * 平台优惠券状态枚举
 * @author yzc
 * @version 2.0.0
 * @date 2021/6/28
 */
public enum PlatformCouponStatusEnum {

    /**
     * 待提交审核 - 1
     */
    WAIT_SUBMIT_AUDIT(1, "待提交审核"),

    /**
     * 待审核(一级) - 2
     */
    WAIT_AUDIT_1(2, "待审核(一级)"),

    /**
     * 待审核不通过(一级) - 3
     */
    WAIT_AUDIT_1_REJECT(3, "待审核不通过(一级)"),

    /**
     * 待审核(二级) - 4
     */
    WAIT_AUDIT_2(4, "待审核(二级)"),

    /**
     * 待审核不通过(二级) - 5
     */
    WAIT_AUDIT_2_REJECT(5, "待审核不通过(二级)"),

    /**
     * 待提交 - 6
     */
    WAIT_SUBMIT(6, "待提交"),

    /**
     * 待执行 - 7
     */
    WAIT_EXECUTE(7, "待执行"),

    /**
     * 进行中 - 8
     */
    EXECUTING(8, "进行中"),

    /**
     * 已终止 - 9
     */
    STOP(9, "已终止"),

    /**
     * 已取消 - 10
     */
    CANCEL(10, "已取消"),

    /**
     * 已结束 - 11
     */
    FINISH(11, "已结束");


    private final Integer code;
    private final String message;

    PlatformCouponStatusEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public static String getCodeMessage(Integer code) {
        PlatformCouponStatusEnum status = Arrays.stream(PlatformCouponStatusEnum.values()).filter(e -> e.getCode().equals(code)).findFirst().orElse(null);
        return status == null ? "未知" : status.getMessage();
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return LanguageHolder.getName(this.getClass(), this.code);
    }

}